//----------------------------------*-C++-*----------------------------------//
/*!
 * \file   testTesting.cc
 * \author Jeremy Roberts
 * \date   Jul 14, 2011
 * \brief  Test of the simple Testing utilities.
 * \note   Copyright (C) 2011 Jeremy Roberts. 
 */
//---------------------------------------------------------------------------//
// $Rev::                                               $:Rev of last commit
// $Author::                                            $:Author of last commit
// $Date::                                              $:Date of last commit
//---------------------------------------------------------------------------//

#include <iostream>
#include <cstdlib>

#include "test/Testing.hh"

using namespace testing;
using namespace std;

int testPass();
int testFail();

int main(int argc, char *argv[])
{
  if (argc!=2) cerr << " need just one argument. " << endl;;
  int test = atoi(argv[1]);
  cout << " ------ testTesting ------ " << endl;
  int testvalue = 0;
  int number_of_tests = 3;
  if (test == 1 || test == number_of_tests)
  {
    testvalue += testPass();
  }
  if (test == 2 || test == number_of_tests)
  {
    // we expect testFail to fail, i.e. return 1
    if (testFail() != 1) testvalue += 1;
  }
  if (test > number_of_tests || test < 1)
  {
    cout << " test " << test << " not available. " << endl;
  }
  if (testvalue)
    cout << " failed with value = " << testvalue << endl;
  else
    cout << " passed." << endl;
  return testvalue;
  return 0;
}

int testPass()
{
 TEST(1==1);
 return 0;
}

int testFail()
{
 TEST(1==0);
 return 0; // should *not* be executed. if it does, a bug.
}

//---------------------------------------------------------------------------//
//              end of testTesting.cc
//---------------------------------------------------------------------------//
